import { request } from "@/utils/service"
import { AddMemoryProps, GetRobotIdMemoryListProps } from "./types"

/**
 * @param data 添加记忆体
 * @returns
 */
export const AddMemory = (data: AddMemoryProps) => {
  return request<any>({
    url: "/memory/add",
    method: "POST",
    data
  })
}

/**
 * @param data 获取某个robot的记忆体列表
 * @returns
 */
export const GetRobotIdMemoryList = (data: Partial<GetRobotIdMemoryListProps>) => {
  return request<any>({
    url: "/memory/list",
    method: "POST",
    data
  })
}

/**
 * @param data 删除记忆体
 * @returns
 */
export const DeleteRobotIdMemory = (data: { id: number }) => {
  return request<any>({
    url: "/memory/del",
    method: "POST",
    data
  })
}

/**
 * @param data 获取全部历史聊天记录
 * @returns
 */
export const GetAllHistoryChatList = (data: { page: number }) => {
  return request<any>({
    url: "/token/list",
    method: "POST",
    data
  })
}

/**
 * @param data 根据Robot_id 获取个人的历史聊天记录
 * @returns
 */
export const GetRobotIdHistoryChatList = (data: { page: number; robot_id: number }) => {
  return request<any>({
    url: "/token/robot_list",
    method: "POST",
    data
  })
}

/**
 * @param data 添加聊天事件
 * @returns
 */
export const AddChatEvent = (data: { robot_id: number; question: string }) => {
  return request<any>({
    url: "/token/add",
    method: "POST",
    data
  })
}

/**
 * @param data 获取训练数据设置列表
 * @returns
 */
export const GetTrainListApi = (data: { robot_id: number; page: number }) => {
  return request<any>({
    url: "/knowledge/set_list",
    method: "POST",
    data
  })
}

/**
 * @param data 添加训练数据
 * @returns
 */
export const AddTrainApi = (data: { robot_id: number; knowledge_id: number }) => {
  return request<any>({
    url: "/knowledge/set_add",
    method: "POST",
    data
  })
}

/**
 * @param data 删除训练数据
 * @returns
 */
export const DeleteTrainApi = (data: { id: number }) => {
  return request<any>({
    url: "/knowledge/set_del",
    method: "POST",
    data
  })
}
